extends head

block content
    body.dashboard.form-signin-wrapper
        div#login.container
            form.form-signin
                div.panel.periodic-login
                    span.atomic-number 01
                    div.panel-body.text-center
                        h1.atomic-symbol 果
                        p.atomic-mass 01.161001
                        p.element-name 果然之味
                        i.icons.icon-arrow-down
                        div.form-group.form-animate-text(style="margin-top:40px !important;")
                            input.form-text(v-model='username',type='mail')
                            span.bar
                            label 用户名
                        div.form-group.form-animate-text(style="margin-top:40px !important;")
                            input.form-text(v-model='passwd',type='Password')
                            span.bar
                            label 密码
                        label.pull-left
                            input.checkbox.pull-left(type="checkbox",name="checkbox1")
                            | &nbsp记住我
                        input.btn.col-md-12(type="button",value="登录",@click="login")
                    div.text-center(style="padding:5px;")
                        a(href="/manager/user/forgotpass") 忘记密码
                        a(href="/manager/user/register") | 注册
block append footer
    script(type='text/javascript').
        $(function () {
            var loginForm = new Vue({
                el: '#login',
                data: {
                    username: '',
                    passwd: ''
                },
                methods: {
                    init: function () {
                        $('input').iCheck({
                            checkboxClass: 'icheckbox_flat-aero',
                            radioClass: 'iradio_flat-aero'
                        });
                    },
                    login: function () {
                        if(loginForm.username == ''){
                            zxlib.showAlert("warning","请输入用户名");
                            return;
                        }

                        if (loginForm.passwd == '') {
                            zxlib.showAlert("warning","请输入密码");
                            return;
                        }
                        zxlib.fpost('/manager/user/valid', {
                            username: loginForm.username,
                            passwd: loginForm.passwd
                        }, function (data) {
                            if(data.code === "0") {
                                setTimeout(function () {
                                    location.href = data.url;
                                },1000);

                            }else {
                                zxlib.showAlert("error",data.msg);
                            }
                        }, function (data) {
                            zxlib.showAlert("error",JSON.stringify(data));
                        });
                    }
                }
            });

            loginForm.init();
        });